import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
  // 开启调试工具
  devtools: { enabled: true },

  devServer: {
    port: 9001
  },

  ssr: true,

  // 软件配置
  app: {
    head: {

      // SEO优化
      title: "Lin | Store",
      charset: 'utf-8',
      meta: [
        { name: "description", content: "store" },
        { name: "keyword", content: "Lin | Store" }
      ],

      // 网页图标
      link: [
        { rel: "icon", type: "image/x-icon", href: "logo.svg" }
      ]

    }
  },

  
  // 代理设置
  nitro: {
    devProxy: {
      "/api": {
        target: "https://django.starbucket.xyz", // 这里是接口地址
        changeOrigin: true,
        prependPath: true,
        
      },
    },
  },

  // navie-ui配置
  build: {
    transpile:
      process.env.NODE_ENV === 'production'
        ? [
            'naive-ui',
            'vueuc',
            '@css-render/vue3-ssr',
            '@juggle/resize-observer'
          ]
        : ['@juggle/resize-observer']
      
        
  },
  vite: {
    optimizeDeps: {
      include:
        process.env.NODE_ENV === 'development'
          ? ['naive-ui', 'vueuc', 'date-fns-tz/formatInTimeZone']
          : []
    }
  },

  plugins: [

    {
      src: '~/plugins/pc-rem',
      mode: 'client'
    }
  ],

  components: true,

  // 注册ui组件
  modules: [
    '@element-plus/nuxt', // element
    'nuxt-windicss', //windicss
    [
      '@pinia/nuxt',
      {
        autoImports: [
          // 自动引入 `defineStore()`
          'defineStore',
        ],
      },
    ],
  ],

  css: [
    'element-plus/dist/index.css',
    '@/assets/main.css',
  ],

  elementPlus: {
    importStyle: "css",
    themes: ['dark'],
    icon: "ElIcon"
  },



})
